package app.netant.book.xs321;

import java.net.URLEncoder;

import app.netant.book.base.BaseDown;
import app.netant.book.sjxs.SjxsDown;

public class Xs321Down extends BaseDown {

	@Override
	public void downFile(String filePath, String url) throws Exception {
		
		/*this.downOwnFile(filePath, url);*/
		
		String urlName = url.substring(url.lastIndexOf("name=")+5);
		urlName = URLEncoder.encode(urlName, "utf-8");
		String urlPlus = url.substring(0,url.lastIndexOf("name=")+5);
		
		String newUrl = urlPlus + urlName;
		
		System.out.println("【NewUrl】:"+newUrl);
		
		this.downOwnFile(filePath, newUrl);
		
	}
	
	public static void main(String[] args) throws Exception {
		System.out.println("开始测试下载");
		Xs321Down downControl = new Xs321Down();		
		downControl.downFile("D:/测试.txt", "https://www.xs321.com/modules/article/packdown.php?id=20688&type=txt&fname=柔情姐姐");		
		System.out.println("结束测试下载");
	}

}
